
import 'package:framelib/base/base_service.dart';
import 'package:framelib/net/baseentity.dart';
import 'package:module_business/module_comm/model/comm_entity_factory.dart';
import 'package:module_business/module_comm/model/country_entity.dart';
import 'package:module_business/module_comm/model/credentials_entity.dart';
import 'package:module_business/module_comm/model/user_entity.dart';
import 'net/comm_api.dart';
import 'net/comm_net_utils.dart';

/**
 * ModuleComm 网络层
 */
class ModuleCommService with BaseService{

  //获取token 接口
  Future<BaseEntity> login({Map<String, dynamic> parmsMap}) async {
    return await CommNetUtils.instance.postData<UserEntity,CommEntityFactory>
      (CommEntityFactory.instance,CommApi.instance.api_login_email ,
        isFormData: false,
        params: parmsMap,
    );
  }
  //找回密码 接口
  Future<BaseEntity> api_login_setPassWord({Map<String, dynamic> parmsMap}) async {
    return await CommNetUtils.instance.postData<UserEntity,CommEntityFactory>
      (CommEntityFactory.instance,CommApi.instance.api_login_setPassWord ,
        isFormData: false,
        params: parmsMap,
    );
  }
  //获取oss信息
  Future<BaseEntity> sts_getkey() async{
    return await CommNetUtils.instance.getData<CredentialsEntity,CommEntityFactory>
      (CommEntityFactory.instance,CommApi.instance.sts_getkey,
        queryParameters: {},isList: false);
  }
  //完善用户信息 接口
  Future<BaseEntity> api_user_saveUserInfo({Map<String, dynamic> parmsMap}) async {
    return await CommNetUtils.instance.postData<UserEntity,CommEntityFactory>
      (CommEntityFactory.instance,CommApi.instance.api_user_saveUserInfo ,
        isFormData: false,
        params: parmsMap,
    );
  }
  // 接口
  Future<BaseEntity> api_index_getCountryList() async {
    return await CommNetUtils.instance.postData<CountryEntity,CommEntityFactory>
      (CommEntityFactory.instance,CommApi.instance.api_index_getCountryList ,
      isFormData: false,
      queryParameters: {},isList: true,
    );
  }
  // //获取司机车辆坐标信息
  // Future<BaseEntity> traffic_invoice_getInvoiceRouterPath({Map<String, dynamic> parmsMap}) async{
  //   return await CommNetUtils.instance.getData<SendGoodsPointsEntity,CommEntityFactory>
  //     (CommEntityFactory.instance,CommApi.instance.traffic_invoice_getInvoiceRouterPath ,
  //       queryParameters: parmsMap,isList: false);
  // }
  // //注册
  // Future<BaseEntity> app_register({Map<String, dynamic> parmsMap}) async {
  //   return await CommNetUtils.instance.postData<BaseEntity,CommEntityFactory>
  //     (CommEntityFactory.instance,BaseApi.app_register ,params: parmsMap,
  //       isFormData: false
  //   );
  // }
  //
  // //注册获取验证码
  // Future<BaseEntity> app_verify_code({Map<String, dynamic> parmsMap}) async{
  //   return await CommNetUtils.instance.getData<BaseResultEntity,CommEntityFactory>
  //     (CommEntityFactory.instance,BaseApi.app_verify_code ,queryParameters: parmsMap,isList: false);
  // }
  // //阿里云授权
  // Future<BaseEntity> oss_authorize({Map<String, dynamic> parmsMap}) async {
  //   return await CommNetUtils.instance.postData<OssAuthorizeEntity,CommEntityFactory>
  //     (CommEntityFactory.instance,BaseApi.oss_authorize ,
  //       params: parmsMap,
  //       isFormData: false,
  //       isList: false,
  //   );
  // }
  // //文件上传
  // Future<BaseEntity> file_app_upload({Map<String,dynamic> parmsMap}) async {
  //     return await CommNetUtils.instance.postData<UploadFileEntity,CommEntityFactory>
  //         (CommEntityFactory.instance,BaseApi.file_app_upload ,
  //           params: parmsMap,
  //           isFormData: true,
  //         headers: [{'content-type':'multipart/form-data'},],
  //           isList: false,
  //       );
  //     }
  //     //录音文件上传
  // Future<BaseEntity> app_file_radio_upload({Map<String,dynamic> parmsMap}) async {
  //     return await CommNetUtils.instance.postData<UploadFileEntity,CommEntityFactory>
  //         (CommEntityFactory.instance,BaseApi.app_file_radio_upload ,
  //           params: parmsMap,
  //           isFormData: true,
  //         headers: [{'content-type':'multipart/form-data'},],
  //           isList: false,
  //       );
  //     }
  //     //朋友圈文件上传
  // Future<BaseEntity> file_article_upload({Map<String,dynamic> parmsMap}) async {
  //     return await CommNetUtils.instance.postData<ResultListStrEntity,CommEntityFactory>
  //         (CommEntityFactory.instance,BaseApi.file_article_upload ,
  //           params: parmsMap,
  //           isFormData: true,
  //         headers: [{'content-type':'multipart/form-data'},],
  //           isList: false,
  //       );
  //     }
  // //
  // // Future<BaseEntity> oss_authorize(Map<String,dynamic> map) async {
  // //   return await RequestManager.requestPostData<OssAuthorizeEntity>(
  // //       BaseApi.oss_authorize,
  // //       params: map,
  // //       isList: false);
  // // }
  // //获取阿里云 securityToken
  // Future<BaseEntity> securityToken({Map<String, dynamic> parmsMap}) async {
  //   return await CommNetUtils.instance.postData<OssAuthorizeEntity,CommEntityFactory>
  //     (CommEntityFactory.instance,BaseApi.securityToken ,
  //       params: parmsMap,
  //     isFormData: false,
  //     isList: false,
  //   );
  // }
  // //获取金刚区功能
  // Future<BaseEntity> app_index_core_function({Map<String, dynamic> parmsMap}) async{
  //   return await CommNetUtils.instance.getData<FunctionAreaEntity,CommEntityFactory>
  //     (CommEntityFactory.instance,CommApi.app_index_core_function ,queryParameters: parmsMap,isList: false);
  // }
  // //获取banner
  // Future<BaseEntity> app_index_banner({Map<String, dynamic> parmsMap}) async{
  //   return await CommNetUtils.instance.getData<BannerEntity,CommEntityFactory>
  //     (CommEntityFactory.instance,CommApi.app_index_banner ,queryParameters: parmsMap,isList: false);
  // }
  //
}
